From 7aa31c8a93c92ec46a4be246986e4574cf5ff0e5 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 6 Nov 2025 14:52:37 +0200 Subject: [PATCH] [PATCH] auth: ldap - Fix crash if users are iterated, but userdb_ldap_iterate_fields is not set From 576a2f52bff4c13971d9e6d1172857a4f18ddd14 Mon Sep 17 00:00:00 2001 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1121000 Gbp-Pq: Name bug1121000_dovecot-ldap_Crash_if_iterate_filter_is_set_but_iterate_fields_is_not_set.patch --- src/auth/userdb-ldap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/auth/userdb-ldap.c b/src/auth/userdb-ldap.c index 21f127c..781b097 100644 --- a/src/auth/userdb-ldap.c +++ b/src/auth/userdb-ldap.c @@ -201,8 +201,11 @@ static void userdb_ldap_iterate_callback(struct ldap_connection *conn, &set, &error) < 0) { e_error(event, "%s", error); ctx->ctx.failed = TRUE; - } - else { + } else if (!array_is_created(&set->iterate_fields)) { + e_error(event, "iterate: No userdb_ldap_iterate_fields specified"); + ctx->ctx.failed = TRUE; + settings_free(set); + } else { unsigned int count; const char *const *items = array_get(&set->iterate_fields, &count); for (unsigned int ndx = 0; ndx < count - 1;) { -- 2.30.2